Найти количество четных чисел в каждой строке массива — QBasic(Бейсик)

INPUT "vvedite kolichestvo strok n: ", n
INPUT "vvedite kolichestvo stolbcov m: ", m
DIM a(n, m)
FOR i = 1 TO n
    FOR j = 1 TO m
        PRINT "vvedite a("; i; ","; j; ")";
        INPUT ": ", a(i, j)
    NEXT
NEXT
PRINT "matrica: "
FOR i = 1 TO n
    FOR j = 1 TO m
        PRINT a(i, j);
    NEXT
    PRINT
NEXT
PRINT "kolichestvo chetnyh v strokah:"
FOR i = 1 TO n
    k = 0
    FOR j = 1 TO m
        IF a(i, j) MOD 2 = 0 THEN k = k + 1
    NEXT
    PRINT k;
NEXT

Тестирование выполнено в программе QB64 ( Скачать )

Leave a Comment